<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=2">
<meta name="theme-color" content="#222">
<meta name="generator" content="Hexo 7.2.0">
  <link rel="apple-touch-icon" sizes="180x180" href="/images/ME.ico">
  <link rel="icon" type="image/png" sizes="32x32" href="/images/ME.ico">
  <link rel="icon" type="image/png" sizes="16x16" href="/images/ME.ico">
  <link rel="mask-icon" href="/images/ME.ico" color="#222">

<link rel="stylesheet" href="/css/main.css">


<link rel="stylesheet" href="/lib/font-awesome/css/all.min.css">

<script id="hexo-configurations">
    var NexT = window.NexT || {};
    var CONFIG = {"hostname":"www.zhoubencheng.com","root":"/","scheme":"Pisces","version":"7.8.0","exturl":false,"sidebar":{"position":"left","display":"post","padding":18,"offset":12,"onmobile":false},"copycode":{"enable":false,"show_result":true,"style":"mac"},"back2top":{"enable":true,"sidebar":false,"scrollpercent":true},"bookmark":{"enable":false,"color":"#222","save":"auto"},"fancybox":false,"mediumzoom":false,"lazyload":false,"pangu":false,"comments":{"style":"tabs","active":null,"storage":true,"lazyload":false,"nav":null},"algolia":{"hits":{"per_page":10},"labels":{"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}},"localsearch":{"enable":false,"trigger":"auto","top_n_per_article":1,"unescape":false,"preload":false},"motion":{"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}}};
  </script>

  <meta name="description" content="IEEE754浮点数规范复习 在IEEE754中，不同精度的浮点数各部分位宽如下表所示    格式 总位数 阶码位数 尾数位数     半精度 16 5 10   单精度 32 8 23   双精度 64 11 52   四倍精度 128 15 112">
<meta property="og:type" content="article">
<meta property="og:title" content="半精度&#x2F;单精度浮点数转化">
<meta property="og:url" content="http://www.zhoubencheng.com/2024/08/05/%E5%8D%8A%E7%B2%BE%E5%BA%A6-%E5%8D%95%E7%B2%BE%E5%BA%A6%E6%B5%AE%E7%82%B9%E6%95%B0%E8%BD%AC%E5%8C%96/index.html">
<meta property="og:site_name" content="Benson&#39;s blog">
<meta property="og:description" content="IEEE754浮点数规范复习 在IEEE754中，不同精度的浮点数各部分位宽如下表所示    格式 总位数 阶码位数 尾数位数     半精度 16 5 10   单精度 32 8 23   双精度 64 11 52   四倍精度 128 15 112">
<meta property="og:locale" content="zh_CN">
<meta property="article:published_time" content="2024-08-05T09:54:23.000Z">
<meta property="article:modified_time" content="2024-08-06T05:34:01.945Z">
<meta property="article:author" content="Benson">
<meta property="article:tag" content="计算机系统基础">
<meta name="twitter:card" content="summary">

<link rel="canonical" href="http://www.zhoubencheng.com/2024/08/05/%E5%8D%8A%E7%B2%BE%E5%BA%A6-%E5%8D%95%E7%B2%BE%E5%BA%A6%E6%B5%AE%E7%82%B9%E6%95%B0%E8%BD%AC%E5%8C%96/">


<script id="page-configurations">
  // https://hexo.io/docs/variables.html
  CONFIG.page = {
    sidebar: "",
    isHome : false,
    isPost : true,
    lang   : 'zh-CN'
  };
</script>

  <title>半精度/单精度浮点数转化 | Benson's blog</title>
  






  <noscript>
  <style>
  .use-motion .brand,
  .use-motion .menu-item,
  .sidebar-inner,
  .use-motion .post-block,
  .use-motion .pagination,
  .use-motion .comments,
  .use-motion .post-header,
  .use-motion .post-body,
  .use-motion .collection-header { opacity: initial; }

  .use-motion .site-title,
  .use-motion .site-subtitle {
    opacity: initial;
    top: initial;
  }

  .use-motion .logo-line-before i { left: initial; }
  .use-motion .logo-line-after i { right: initial; }
  </style>
</noscript>


<style>.github-emoji { position: relative; display: inline-block; width: 1.2em; min-height: 1.2em; overflow: hidden; vertical-align: top; color: transparent; }  .github-emoji > span { position: relative; z-index: 10; }  .github-emoji img, .github-emoji .fancybox { margin: 0 !important; padding: 0 !important; border: none !important; outline: none !important; text-decoration: none !important; user-select: none !important; cursor: auto !important; }  .github-emoji img { height: 1.2em !important; width: 1.2em !important; position: absolute !important; left: 50% !important; top: 50% !important; transform: translate(-50%, -50%) !important; user-select: none !important; cursor: auto !important; } .github-emoji-fallback { color: inherit; } .github-emoji-fallback img { opacity: 0 !important; }</style>
</head>

<body itemscope itemtype="http://schema.org/WebPage">
  <div class="container use-motion">
    <div class="headband"></div>

    <header class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-container">
  <div class="site-nav-toggle">
    <div class="toggle" aria-label="切换导航栏">
      <span class="toggle-line toggle-line-first"></span>
      <span class="toggle-line toggle-line-middle"></span>
      <span class="toggle-line toggle-line-last"></span>
    </div>
  </div>

  <div class="site-meta">

    <a href="/" class="brand" rel="start">
      <span class="logo-line-before"><i></i></span>
      <h1 class="site-title">Benson's blog</h1>
      <span class="logo-line-after"><i></i></span>
    </a>
      <p class="site-subtitle" itemprop="description">最好的安排</p>
  </div>

  <div class="site-nav-right">
    <div class="toggle popup-trigger">
    </div>
  </div>
</div>




<nav class="site-nav">
  <ul id="menu" class="main-menu menu">
        <li class="menu-item menu-item-home">

    <a href="/" rel="section"><i class="fa fa-home fa-fw"></i>首页</a>

  </li>
        <li class="menu-item menu-item-tags">

    <a href="/tags/" rel="section"><i class="fa fa-tags fa-fw"></i>标签</a>

  </li>
        <li class="menu-item menu-item-categories">

    <a href="/categories/" rel="section"><i class="fa fa-th fa-fw"></i>分类</a>

  </li>
        <li class="menu-item menu-item-archives">

    <a href="/archives/" rel="section"><i class="fa fa-archive fa-fw"></i>归档</a>

  </li>
  </ul>
</nav>




</div>
    </header>

    
  <div class="back-to-top">
    <i class="fa fa-arrow-up"></i>
    <span>0%</span>
  </div>

  <a href="https://github.com/ZhouBencheng" class="github-corner" title="Follow me on GitHub" aria-label="Follow me on GitHub" rel="noopener" target="_blank"><svg width="80" height="80" viewBox="0 0 250 250" aria-hidden="true"><path d="M0,0 L115,115 L130,115 L142,142 L250,250 L250,0 Z"></path><path d="M128.3,109.0 C113.8,99.7 119.0,89.6 119.0,89.6 C122.0,82.7 120.5,78.6 120.5,78.6 C119.2,72.0 123.4,76.3 123.4,76.3 C127.3,80.9 125.5,87.3 125.5,87.3 C122.9,97.6 130.6,101.9 134.4,103.2" fill="currentColor" style="transform-origin: 130px 106px;" class="octo-arm"></path><path d="M115.0,115.0 C114.9,115.1 118.7,116.5 119.8,115.4 L133.7,101.6 C136.9,99.2 139.9,98.4 142.2,98.6 C133.8,88.0 127.5,74.4 143.8,58.0 C148.5,53.4 154.0,51.2 159.7,51.0 C160.3,49.4 163.2,43.6 171.4,40.1 C171.4,40.1 176.1,42.5 178.8,56.2 C183.1,58.6 187.2,61.8 190.9,65.4 C194.5,69.0 197.7,73.2 200.1,77.6 C213.8,80.2 216.3,84.9 216.3,84.9 C212.7,93.1 206.9,96.0 205.4,96.6 C205.1,102.4 203.0,107.8 198.3,112.5 C181.9,128.9 168.3,122.5 157.7,114.1 C157.9,116.9 156.7,120.9 152.7,124.9 L141.0,136.5 C139.8,137.7 141.6,141.9 141.8,141.8 Z" fill="currentColor" class="octo-body"></path></svg></a>


    <main class="main">
      <div class="main-inner">
        <div class="content-wrap">
          

          <div class="content post posts-expand">
            

    
  
  
  <article itemscope itemtype="http://schema.org/Article" class="post-block" lang="zh-CN">
    <link itemprop="mainEntityOfPage" href="http://www.zhoubencheng.com/2024/08/05/%E5%8D%8A%E7%B2%BE%E5%BA%A6-%E5%8D%95%E7%B2%BE%E5%BA%A6%E6%B5%AE%E7%82%B9%E6%95%B0%E8%BD%AC%E5%8C%96/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/images/ME.ico">
      <meta itemprop="name" content="Benson">
      <meta itemprop="description" content="Share my thoughts with you">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="Benson's blog">
    </span>
      <header class="post-header">
        <h1 class="post-title" itemprop="name headline">
          半精度/单精度浮点数转化
        </h1>

        <div class="post-meta">
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="far fa-calendar"></i>
              </span>
              <span class="post-meta-item-text">发表于</span>

              <time title="创建时间：2024-08-05 17:54:23" itemprop="dateCreated datePublished" datetime="2024-08-05T17:54:23+08:00">2024-08-05</time>
            </span>
              <span class="post-meta-item">
                <span class="post-meta-item-icon">
                  <i class="far fa-calendar-check"></i>
                </span>
                <span class="post-meta-item-text">更新于</span>
                <time title="修改时间：2024-08-06 13:34:01" itemprop="dateModified" datetime="2024-08-06T13:34:01+08:00">2024-08-06</time>
              </span>
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="far fa-folder"></i>
              </span>
              <span class="post-meta-item-text">分类于</span>
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/categories/System/" itemprop="url" rel="index"><span itemprop="name">System</span></a>
                </span>
            </span>

          
            <span class="post-meta-item" title="阅读次数" id="busuanzi_container_page_pv" style="display: none;">
              <span class="post-meta-item-icon">
                <i class="fa fa-eye"></i>
              </span>
              <span class="post-meta-item-text">阅读次数：</span>
              <span id="busuanzi_value_page_pv"></span>
            </span>

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">

      
        <h2 id="ieee754浮点数规范复习">IEEE754浮点数规范复习</h2>
<p>在IEEE754中，不同精度的浮点数各部分位宽如下表所示</p>
<table>
<thead>
<tr>
<th>格式</th>
<th>总位数</th>
<th>阶码位数</th>
<th>尾数位数</th>
</tr>
</thead>
<tbody>
<tr>
<td>半精度</td>
<td>16</td>
<td>5</td>
<td>10</td>
</tr>
<tr>
<td>单精度</td>
<td>32</td>
<td>8</td>
<td>23</td>
</tr>
<tr>
<td>双精度</td>
<td>64</td>
<td>11</td>
<td>52</td>
</tr>
<tr>
<td>四倍精度</td>
<td>128</td>
<td>15</td>
<td>112</td>
</tr>
</tbody>
</table>
<span id="more"></span>
<p>规格化数和非规格化数</p>
<ul>
<li><p>规格化数</p>
<p>阶码不允许出现<strong>全0</strong>或者<strong>全1</strong>的情况，指数在阶码中的编码形式为<strong>偏移码</strong>，偏移量为<span class="math inline">\(2^{k - 1} - 1\)</span></p></li>
<li><p>非规格化数</p>
<ul>
<li>阶码全1
<ul>
<li>尾数全0，表示∞</li>
<li>尾数非0，表示NaN(Not a number)</li>
</ul></li>
<li>阶码全0
<ul>
<li>尾数全0，表示浮点数0</li>
<li>尾数非0，指数仍然为<span class="math inline">\(1 -
offset\)</span>，底数表示<span class="math inline">\(0.M\)</span>，注意此时不同于规格化数默认小数点左侧为1</li>
</ul></li>
</ul></li>
</ul>
<h2 id="c语言转换实现">C语言转换实现</h2>
<p>该方法中需要注意的是非规格化数<code>0.···</code>的转化，该部分代码将<code>fraction</code>部分的编码持续左移，直到最高位1超出10位的位宽，其目的是重新构造规格化表示的小数，所以可以看到<code>exponent</code>也在同步递减来保持原来的指数</p>
<blockquote>
<p>我们知道在阶码全0的非规格化数中存在一种‘合法’表示的浮点数，该浮点数的小数部分<strong>前不补1</strong>，同时阶码部分仍视为<span class="math inline">\(1 -
offset\)</span>（原因是用于和最小的规格化浮点数平滑的连接）</p>
</blockquote>
<figure class="highlight c"><table><tbody><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">#<span class="keyword">include</span> <span class="string">&lt;stdio.h&gt;</span></span></span><br><span class="line"><span class="comment">// 此处如果是MacOS，稍微别名一下类型</span></span><br><span class="line"><span class="meta">#<span class="keyword">ifdef</span> __APPLE__</span></span><br><span class="line"><span class="keyword">typedef</span> <span class="type">u_int16_t</span> <span class="type">uint16_t</span>;</span><br><span class="line"><span class="keyword">typedef</span> <span class="type">u_int32_t</span> <span class="type">uint32_t</span>;</span><br><span class="line"><span class="meta">#<span class="keyword">endif</span></span></span><br><span class="line"></span><br><span class="line"><span class="type">float</span> <span class="title function_">convert_Float16_to_float</span><span class="params">(_Float16 val)</span> {</span><br><span class="line">    <span class="type">uint16_t</span> fp16 = *(<span class="type">uint16_t</span>*)&amp;val;</span><br><span class="line">    <span class="type">uint32_t</span> sign = (fp16 &amp; <span class="number">0x8000</span>) &lt;&lt; <span class="number">16</span>;</span><br><span class="line">    <span class="type">uint32_t</span> exponent = (fp16 &amp; <span class="number">0x7C00</span>) &gt;&gt; <span class="number">10</span>;</span><br><span class="line">    <span class="type">uint32_t</span> fraction = (fp16 &amp; <span class="number">0x03FF</span>);</span><br><span class="line">    <span class="comment">// 非规格化数处理</span></span><br><span class="line">    <span class="keyword">if</span> (exponent == <span class="number">0</span>) {</span><br><span class="line">        <span class="keyword">if</span> (fraction == <span class="number">0</span>) { <span class="comment">// 0</span></span><br><span class="line">            <span class="keyword">return</span> *(<span class="type">float</span>*)&amp;sign;</span><br><span class="line">        }</span><br><span class="line">        <span class="comment">// 0.···数规格化</span></span><br><span class="line">        exponent = <span class="number">1</span>;</span><br><span class="line">        <span class="keyword">while</span> ((fraction &amp; <span class="number">0x0400</span>) == <span class="number">0</span>) {</span><br><span class="line">            fraction &lt;&lt;= <span class="number">1</span>;</span><br><span class="line">            exponent -= <span class="number">1</span>;</span><br><span class="line">        }</span><br><span class="line">        fraction &amp;= ~<span class="number">0x0400</span>;</span><br><span class="line">    } <span class="keyword">else</span> <span class="keyword">if</span> (exponent == <span class="number">0x001F</span>) {</span><br><span class="line">        <span class="keyword">if</span> (fraction == <span class="number">0</span>) { <span class="comment">// ∞</span></span><br><span class="line">            sign |= <span class="number">0x7F800000</span>;</span><br><span class="line">            <span class="keyword">return</span> *(<span class="type">float</span>*)&amp;sign;</span><br><span class="line">        }</span><br><span class="line">        <span class="comment">// NaN</span></span><br><span class="line">        sign |= (<span class="number">0x7F800000</span> | fraction &lt;&lt; <span class="number">13</span>);</span><br><span class="line">        <span class="keyword">return</span> *(<span class="type">float</span>*)&amp;sign;</span><br><span class="line">    }</span><br><span class="line">    exponent = exponent - <span class="number">15</span> + <span class="number">127</span>;</span><br><span class="line">    fraction &lt;&lt;= <span class="number">13</span>;</span><br><span class="line">    sign |= (exponent &lt;&lt; <span class="number">23</span> | fraction);</span><br><span class="line">    <span class="keyword">return</span> *(<span class="type">float</span>*)&amp;sign;</span><br><span class="line">}</span><br><span class="line"></span><br><span class="line"><span class="type">int</span> <span class="title function_">main</span><span class="params">()</span> {</span><br><span class="line">    _Float16 val16 = <span class="number">2</span>;</span><br><span class="line">    <span class="type">float</span> val32 = convert_Float16_to_float(val16);</span><br><span class="line">    <span class="built_in">printf</span>(<span class="string">"%f\n"</span>, val32);</span><br><span class="line">    <span class="keyword">return</span> <span class="number">0</span>;</span><br><span class="line">}</span><br></pre></td></tr></tbody></table></figure>
<h2 id="关于c语言强制类型转换的思考">关于C语言强制类型转换的思考</h2>
<p>C语言的强制类型转换在两方面存在差异：整型之间的转化、整型和浮点数之间的转换</p>
<h3 id="有符号整数无符号整数的转换">有符号整数/无符号整数的转换</h3>
<p>在整型有无符号的转换之间，编译器并不会改变变量的底层编码，仅改变编码的解读方式</p>
<figure class="highlight c"><table><tbody><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="type">int</span> <span class="title function_">main</span><span class="params">()</span> {</span><br><span class="line">  <span class="type">int</span> x = <span class="number">-1</span>;</span><br><span class="line">  <span class="built_in">printf</span>(<span class="string">"unsigned x = %u, signed x = %d\n"</span>, (<span class="type">unsigned</span>)x, x);</span><br><span class="line">}</span><br></pre></td></tr></tbody></table></figure>
<p>输出<code>unsigned x = 4294967295, signed x = -1</code>，这两个数底层编码相同。但情况在浮点数/整数之间不同</p>
<h3 id="整型浮点数的转换">整型/浮点数的转换</h3>
<p>如果将整数/浮点数之间相互转换，C语言编译器会改变相应变量的底层编码，即<strong>补码</strong>和<strong>IEEE754浮点数</strong>两种编码方式之间的转换。同时需要注意的是C语言中<strong>不支持浮点数位运算</strong>，因此在上述示例代码中我采用指针的强制类型转换形式来保留编码格式</p>

    </div>

    
    
    

      <footer class="post-footer">
          
          <div class="post-tags">
              <a href="/tags/%E8%AE%A1%E7%AE%97%E6%9C%BA%E7%B3%BB%E7%BB%9F%E5%9F%BA%E7%A1%80/" rel="tag"><i class="fa fa-tag"></i> 计算机系统基础</a>
          </div>

        


        
    <div class="post-nav">
      <div class="post-nav-item">
    <a href="/2024/07/04/Servlet/" rel="prev" title="Servlet">
      <i class="fa fa-chevron-left"></i> Servlet
    </a></div>
      <div class="post-nav-item">
    <a href="/2024/08/06/RISCV%E5%90%91%E9%87%8F%E6%89%A9%E5%B1%95/" rel="next" title="RISCV向量扩展">
      RISCV向量扩展 <i class="fa fa-chevron-right"></i>
    </a></div>
    </div>
      </footer>
    
  </article>
  
  
  



          </div>
          

<script>
  window.addEventListener('tabs:register', () => {
    let { activeClass } = CONFIG.comments;
    if (CONFIG.comments.storage) {
      activeClass = localStorage.getItem('comments_active') || activeClass;
    }
    if (activeClass) {
      let activeTab = document.querySelector(`a[href="#comment-${activeClass}"]`);
      if (activeTab) {
        activeTab.click();
      }
    }
  });
  if (CONFIG.comments.storage) {
    window.addEventListener('tabs:click', event => {
      if (!event.target.matches('.tabs-comment .tab-content .tab-pane')) return;
      let commentClass = event.target.classList[1];
      localStorage.setItem('comments_active', commentClass);
    });
  }
</script>

        </div>
          
  
  <div class="toggle sidebar-toggle">
    <span class="toggle-line toggle-line-first"></span>
    <span class="toggle-line toggle-line-middle"></span>
    <span class="toggle-line toggle-line-last"></span>
  </div>

  <aside class="sidebar">
    <div class="sidebar-inner">

      <ul class="sidebar-nav motion-element">
        <li class="sidebar-nav-toc">
          文章目录
        </li>
        <li class="sidebar-nav-overview">
          站点概览
        </li>
      </ul>

      <!--noindex-->
      <div class="post-toc-wrap sidebar-panel">
          <div class="post-toc motion-element"><ol class="nav"><li class="nav-item nav-level-2"><a class="nav-link" href="#ieee754%E6%B5%AE%E7%82%B9%E6%95%B0%E8%A7%84%E8%8C%83%E5%A4%8D%E4%B9%A0"><span class="nav-number">1.</span> <span class="nav-text">IEEE754浮点数规范复习</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#c%E8%AF%AD%E8%A8%80%E8%BD%AC%E6%8D%A2%E5%AE%9E%E7%8E%B0"><span class="nav-number">2.</span> <span class="nav-text">C语言转换实现</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#%E5%85%B3%E4%BA%8Ec%E8%AF%AD%E8%A8%80%E5%BC%BA%E5%88%B6%E7%B1%BB%E5%9E%8B%E8%BD%AC%E6%8D%A2%E7%9A%84%E6%80%9D%E8%80%83"><span class="nav-number">3.</span> <span class="nav-text">关于C语言强制类型转换的思考</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#%E6%9C%89%E7%AC%A6%E5%8F%B7%E6%95%B4%E6%95%B0%E6%97%A0%E7%AC%A6%E5%8F%B7%E6%95%B4%E6%95%B0%E7%9A%84%E8%BD%AC%E6%8D%A2"><span class="nav-number">3.1.</span> <span class="nav-text">有符号整数&#x2F;无符号整数的转换</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#%E6%95%B4%E5%9E%8B%E6%B5%AE%E7%82%B9%E6%95%B0%E7%9A%84%E8%BD%AC%E6%8D%A2"><span class="nav-number">3.2.</span> <span class="nav-text">整型&#x2F;浮点数的转换</span></a></li></ol></li></ol></div>
      </div>
      <!--/noindex-->

      <div class="site-overview-wrap sidebar-panel">
        <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
    <img class="site-author-image" itemprop="image" alt="Benson"
      src="/images/ME.ico">
  <p class="site-author-name" itemprop="name">Benson</p>
  <div class="site-description" itemprop="description">Share my thoughts with you</div>
</div>
<div class="site-state-wrap motion-element">
  <nav class="site-state">
      <div class="site-state-item site-state-posts">
          <a href="/archives/">
        
          <span class="site-state-item-count">17</span>
          <span class="site-state-item-name">日志</span>
        </a>
      </div>
      <div class="site-state-item site-state-categories">
            <a href="/categories/">
          
        <span class="site-state-item-count">7</span>
        <span class="site-state-item-name">分类</span></a>
      </div>
      <div class="site-state-item site-state-tags">
            <a href="/tags/">
          
        <span class="site-state-item-count">25</span>
        <span class="site-state-item-name">标签</span></a>
      </div>
  </nav>
</div>
  <div class="links-of-author motion-element">
      <span class="links-of-author-item">
        <a href="https://github.com/ZhouBencheng" title="GitHub → https:&#x2F;&#x2F;github.com&#x2F;ZhouBencheng" rel="noopener" target="_blank"><i class="fab fa-github fa-fw"></i>GitHub</a>
      </span>
      <span class="links-of-author-item">
        <a href="mailto:zhoubencheng2022@163.com" title="E-Mail → mailto:zhoubencheng2022@163.com" rel="noopener" target="_blank"><i class="fa fa-envelope fa-fw"></i>E-Mail</a>
      </span>
  </div>



      </div>

    </div>
  </aside>
  <div id="sidebar-dimmer"></div>


      </div>
    </main>

    <footer class="footer">
      <div class="footer-inner">
        

        

<div class="copyright">
  
  &copy; 
  <span itemprop="copyrightYear">2024</span>
  <span class="with-love">
    <i class="fa fa-heart"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">Benson</span>
</div>

<!--
  <div class="powered-by">由 <a href="https://hexo.io/" class="theme-link" rel="noopener" target="_blank">Hexo</a> & <a href="https://pisces.theme-next.org/" class="theme-link" rel="noopener" target="_blank">NexT.Pisces</a> 强力驱动
  </div>
-->

        
<div class="busuanzi-count">
  <script async src="https://busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script>
    <span class="post-meta-item" id="busuanzi_container_site_uv" style="display: none;">
      <span class="post-meta-item-icon">
        <i class="fa fa-user"></i>
      </span>
      <span class="site-uv" title="总访客量">
        <span id="busuanzi_value_site_uv"></span>
      </span>
    </span>
    <span class="post-meta-divider">|</span>
    <span class="post-meta-item" id="busuanzi_container_site_pv" style="display: none;">
      <span class="post-meta-item-icon">
        <i class="fa fa-eye"></i>
      </span>
      <span class="site-pv" title="总访问量">
        <span id="busuanzi_value_site_pv"></span>
      </span>
    </span>
</div>








      </div>
    </footer>
  </div>

  
  <script src="/lib/anime.min.js"></script>
  <script src="/lib/velocity/velocity.min.js"></script>
  <script src="/lib/velocity/velocity.ui.min.js"></script>

<script src="/js/utils.js"></script>

<script src="/js/motion.js"></script>


<script src="/js/schemes/pisces.js"></script>


<script src="/js/next-boot.js"></script>


  <script defer src="/lib/three/three.min.js"></script>
    <script defer src="/lib/three/canvas_lines.min.js"></script>


  













<script>
if (document.querySelectorAll('pre.mermaid').length) {
  NexT.utils.getScript('//cdn.jsdelivr.net/npm/mermaid@8/dist/mermaid.min.js', () => {
    mermaid.initialize({
      theme    : 'dark',
      logLevel : 3,
      flowchart: { curve     : 'linear' },
      gantt    : { axisFormat: '%m/%d/%Y' },
      sequence : { actorMargin: 50 }
    });
  }, window.mermaid);
}
</script>


  

  

  

</body>
</html>
